package com.hnevc.xiaoming.activity;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;

import androidx.appcompat.app.AppCompatActivity;

import com.hnevc.xiaoming.MainActivity;
import com.hnevc.xiaoming.R;
import com.hnevc.xiaoming.adapter.MySpAdapter;
import com.hnevc.xiaoming.bean.SpBean;

import java.util.ArrayList;
import java.util.List;

public class MyShoping extends AppCompatActivity {

    private ImageView back_home;
    private ListView lv_shaoping;
    private List<SpBean> spBeans;
    private MySpAdapter mySpAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_shoping);
        initView();
        initData();
        initEvent();
    }

    private void initEvent() {

        back_home.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });


    }



    private void initData() {

        spBeans = new ArrayList<>();
        spBeans.add(new SpBean(1,"蚂蚁上树","蚂蚁上树蚂蚁上树蚂蚁上树","one"));
        spBeans.add(new SpBean(2,"红烧肉","红烧肉红烧肉红烧肉","tow"));
        spBeans.add(new SpBean(3,"月饼","月饼月饼月饼","fore"));
        spBeans.add(new SpBean(4,"青椒肉丝","青椒肉丝青椒肉丝青椒肉丝","tree"));spBeans.add(new SpBean(1,"蚂蚁上树","蚂蚁上树蚂蚁上树蚂蚁上树","one"));
        spBeans.add(new SpBean(5,"红烧肉","红烧肉红烧肉红烧肉","tow"));
        spBeans.add(new SpBean(6,"月饼","月饼月饼月饼","fore"));
        spBeans.add(new SpBean(7,"青椒肉丝","青椒肉丝青椒肉丝青椒肉丝","tree"));
        mySpAdapter = new MySpAdapter(spBeans,MyShoping.this);
        lv_shaoping.setAdapter(mySpAdapter);

    }

    private void initView() {
        back_home = (ImageView) findViewById(R.id.back_home);
        lv_shaoping = (ListView) findViewById(R.id.lv_shaoping);
    }


}